
package ProOF.apl.methods.GA;

import ProOF.apl.factorys.fProblem;
import ProOF.apl.factorys.fStop;
import ProOF.apl.methods.GA.population.aPopulation;
import ProOF.apl.methods.GA.population.fPopulation;
import ProOF.com.LinkerNodes;
import ProOF.com.LinkerParameters;
import ProOF.com.runner.ExceptionForceFinish;
import ProOF.gen.stopping.aStop;
import ProOF.opt.abst.metaheuristic.MetaHeuristic;
import ProOF.opt.abst.problem.meta.Problem;

/**
 *
 * @author Hossomi
 */
public class GA extends MetaHeuristic  {
	private Problem			problem;
	private aPopulation		population;
    private aStop           stop;
	
	@Override
	public void parameters(LinkerParameters win) throws Exception {
		
	}
	
	@Override
	public void services(LinkerNodes link) throws Exception {
		problem = link.get(fProblem.obj, problem);
		population = link.get( fPopulation.obj, population );
        stop = link.get( fStop.obj, stop );
	}
	
	@Override
	public void execute() throws Exception {
		try {
            population.initialize();
            population.evolve();
        }
        catch (ExceptionForceFinish e) {
            System.out.println("\nFinished!");
        }
	}
	
	@Override
	public String name() {
		return "Hossomi GA";
	}
	
}
